{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "b8bd7a7f",
   "metadata": {},
   "source": [
    "# 本周知识点"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "a9e8495a",
   "metadata": {},
   "source": [
    ">1. while循环\n",
    ">2. 购物车的练习\n",
    ">3. 元组_集合"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "2e3f910d",
   "metadata": {},
   "outputs": [
    {
     "ename": "NameError",
     "evalue": "name 'count' is not defined",
     "output_type": "error",
     "traceback": [
      "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m",
      "\u001b[1;31mNameError\u001b[0m                                 Traceback (most recent call last)",
      "Input \u001b[1;32mIn [4]\u001b[0m, in \u001b[0;36m<cell line: 4>\u001b[1;34m()\u001b[0m\n\u001b[0;32m      1\u001b[0m \u001b[38;5;66;03m# while Ture 可以实现for + range的方法\u001b[39;00m\n\u001b[0;32m      2\u001b[0m \u001b[38;5;66;03m# while Ture 一般用于不确定的循环次数或者无限次循环操作\u001b[39;00m\n\u001b[0;32m      3\u001b[0m \u001b[38;5;28;01mwhile\u001b[39;00m \u001b[38;5;28;01mTrue\u001b[39;00m:\n\u001b[1;32m----> 4\u001b[0m     \u001b[38;5;28mprint\u001b[39m(\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124m傻逼，傻逼，傻逼\u001b[39m\u001b[38;5;124m\"\u001b[39m,\u001b[43mcount\u001b[49m)\n\u001b[0;32m      5\u001b[0m     count \u001b[38;5;241m+\u001b[39m\u001b[38;5;241m1\u001b[39m\n\u001b[0;32m      6\u001b[0m     \u001b[38;5;28;01mif\u001b[39;00m count \u001b[38;5;241m+\u001b[39m\u001b[38;5;241m1\u001b[39m\u001b[38;5;241m==\u001b[39m \u001b[38;5;241m100\u001b[39m:\n",
      "\u001b[1;31mNameError\u001b[0m: name 'count' is not defined"
     ]
    }
   ],
   "source": [
    "# while Ture 可以实现for + range的方法\n",
    "# while Ture 一般用于不确定的循环次数或者无限次循环操作\n",
    "while True:\n",
    "    print(\"傻逼，傻逼，傻逼\")\n",
    "    count +1\n",
    "    if count +1== 100:\n",
    "        break"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "1793e6d2",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "hide_card:23\n"
     ]
    }
   ],
   "source": [
    "# 猜数字小游戏： 0<n<100,5次机会猜数字，每次才玩出题人提示你猜的有点大或有点小\n",
    "hide_card = int(input(\"hide_card:\"))\n",
    "count = 0"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "id": "b74ed3a6",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "游戏开始了\n",
      "guess_digit32\n",
      "往小了猜\n",
      "guess_digit20\n",
      "往大了猜\n",
      "guess_digit21\n",
      "往大了猜\n",
      "guess_digit22\n",
      "往大了猜\n",
      "guess_digit23\n",
      "you got it!\n"
     ]
    }
   ],
   "source": [
    "if hide_card <100 and hide_card>0 :\n",
    "    print(\"游戏开始了\")\n",
    "    while True:\n",
    "        if count <5:\n",
    "            guess_digit = int(input(\"guess_digit\")) # 玩游戏的人\n",
    "            if guess_digit == hide_card:\n",
    "                print(\"you got it!\")\n",
    "                break\n",
    "            elif guess_digit > hide_card:\n",
    "                print(\"往小了猜\")\n",
    "            else:\n",
    "                print(\"往大了猜\")\n",
    "            count = count+1\n",
    "        else:\n",
    "            print(\"猜这么多次都不对，你个笨蛋！\")\n",
    "            print(\"正确答案是：%s\"%hide_card)\n",
    "            break\n",
    "else:\n",
    "    print(\"请输入0-99间，不要耍赖！\")"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "8d7687f2",
   "metadata": {},
   "source": [
    "## 购物车"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "id": "f482fa71",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "请输入余额：10000\n"
     ]
    }
   ],
   "source": [
    "# 1. 运行程序后，让用户输入支付宝余额，然后打印商品列表给客户\n",
    "good_list = [\n",
    "    ('商品1'，10),\n",
    "    （'商品2'，15）,\n",
    "    ('商品3'，20)，\n",
    "    \n",
    "]\n",
    "wxpay = int(input(\"请输入余额：\"))\n",
    "print(\"-----商品栏-----\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "649187a9",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.9.12"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
